
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
stack-slice
Advanced tools
Slice a file or directory from the middle of an Error stack trace
Sometimes you get an error at a point when you are the middle man, and you want to remove your function from the stack.
usualy if you are a masheling function and dont want to litter the stack with your implementation.
It is too late to use captureStackTrace
thus this allows you to splice your call sites out of the stack.
###stackSlice(error, path[, allowPartialMatch])
var stackSlice = require('stack-slice'),
error = new Error('BANG!!!');
// Assume error.stack is the following
// Error: BANG!!!
// at run (/foo/bar/myCoolModule/node_modules/someOtherModule/node_modulesrun.js:11:11)
// at foo (/foo/bar/myCoolModule/node_modules/someOtherModule/run.js:11:11)
// at bar (/foo/bar/myCoolModule/run.js:11:11)
// at stuff (/foo/bar/myCoolModule/main.js:11:11)
// at processImmediate [as _immediateCallback] (timers.js:11:11)
stackSlice(error, '/foo/bar/myCoolModule/main.js');
// error.stack is now
// Error: BANG!!!
// at run (/foo/bar/myCoolModule/node_modules/someOtherModule/node_modulesrun.js:11:11)
// at foo (/foo/bar/myCoolModule/node_modules/someOtherModule/run.js:11:11)
// at bar (/foo/bar/myCoolModule/run.js:11:11)
// at processImmediate [as _immediateCallback] (timers.js:11:11)
stackSlice(error, '/foo/bar/myCoolModule/node_modules/someOtherModule', true);
// error.stack is now
// Error: BANG!!!
// at bar (/foo/bar/myCoolModule/run.js:11:11)
// at processImmediate [as _immediateCallback] (timers.js:11:11)
childModule.run(functionFromParentModule, function(error, result){
if(error){
// remove all callsite for this module leaving parent and child
stackSlice(error, __dirname, true);
return callback(error);
}
callback(null, result);
});
FAQs
Slice a file or directory from the middle of an Error stack trace
The npm package stack-slice receives a total of 198 weekly downloads. As such, stack-slice popularity was classified as not popular.
We found that stack-slice demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.